package cn.cvs.controller;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

//Handle
//   /hello
public class Ch09LoginController extends AbstractController {
    @Override
    protected ModelAndView handleRequestInternal
            (HttpServletRequest request, HttpServletResponse httpServletResponse) throws Exception {
        System.out.println("欢迎来到spring MVC 的世界");

        System.out.println("username: "+request.getParameter("username"));

        //把数据从controller 传递到  jsp
        ModelAndView model = new ModelAndView("/user/userlist.jsp");
        //设置 view
       // model.setViewName("/user/userlist.jsp");
        //设置 model
        model.addObject("cly","曹良玉是最棒的") ;// reqeuset.setAttribute("key","value")
        model.addObject("cly","曹良玉");

        return model; // jsp/index.jsp
    }
}
